package gof.com.yew.singleton;

/**
 * 除枚举类外，其他单例模式存在反射漏洞
 * 单例模式防止反射漏洞(饿汉式为例)
 */

public class SingletonDemo06 {
	
	private static SingletonDemo06 instance = new SingletonDemo06();
	//构造器私有
	private  SingletonDemo06() {
		if(instance!=null) {
			throw new RuntimeException();
		}
	}
	
	//提供统一访问入口
	public static SingletonDemo06 getInstance() {
		return instance;
	}

}
